home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmSetup
- Caption = "Chat Setup"
- ClientHeight = 1740
- ClientLeft = 2280
- ClientTop = 1575
- ClientWidth = 5790
- Height = 2220
- Left = 2220
- LinkTopic = "Form2"
- ScaleHeight = 1740
- ScaleWidth = 5790
- Top = 1155
- Width = 5910
- Begin VB.Frame Frame1
- Caption = "Chat Settings:"
- Height = 1545
- Left = 90
- TabIndex = 0
- Top = 90
- Width = 5595
- Begin VB.CommandButton Command1
- Caption = "Exit"
- Height = 375
- Left = 3960
- TabIndex = 10
- Top = 990
- Width = 1455
- End
- Begin VB.CommandButton cmdConnect
- Caption = "Connect to Host"
- Enabled = 0 'False
- Height = 375
- Left = 3960
- TabIndex = 9
- Top = 360
- Width = 1455
- End
- Begin VB.TextBox txtPort
- Height = 285
- Left = 2160
- TabIndex = 4
- Top = 450
- Width = 1545
- End
- Begin VB.TextBox txtHostAddress
- Height = 285
- Left = 2160
- TabIndex = 8
- Top = 1080
- Width = 1545
- End
- Begin VB.TextBox txtHostName
- Height = 285
- Left = 180
- TabIndex = 6
- Top = 1080
- Width = 1545
- End
- Begin VB.TextBox txtName
- Height = 285
- Left = 180
- TabIndex = 2
- Top = 450
- Width = 1545
- End
- Begin VB.Label Label4
- Caption = "Port Number:"
- Height = 195
- Left = 2160
- TabIndex = 3
- Top = 270
- Width = 1545
- End
- Begin VB.Label Label3
- Caption = "HostAddress:"
- Height = 285
- Left = 2160
- TabIndex = 7
- Top = 900
- Width = 1545
- End
- Begin VB.Label Label2
- Caption = "HostName:"
- Height = 285
- Left = 180
- TabIndex = 5
- Top = 900
- Width = 1545
- End
- Begin VB.Label Label1
- Caption = "Screen Name:"
- Height = 285
- Left = 180
- TabIndex = 1
- Top = 270
- Width = 1545
- End
- End
- Attribute VB_Name = "frmSetup"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub CITCP1_Connection(ByVal address As String)
- Print address
- End Sub
- Private Sub CITCP1_PacketReceived(Packet As Variant, ByVal bytes_in As Integer)
- 'If packet arrives, display it
- Print Packet
- End Sub
- Private Sub cmdConnect_Click()
- Dim temp As Variant
- On Error GoTo Connect_Failure
- ScreenName = txtName.Text
- ' port numbers should be in the range of 1 to 65535
- ' for port number greater than 32767 a negative number
- ' needs to be used to conform to VB's Integer data type.
- temp = Int(Val(txtPort.Text))
- If temp < -32768 Or temp > 32767 Or temp = 0 Then 'invalid port
- MsgBox "Port number must be between -32768 and 32767 excluding the value of zero", 0, "Invalid Parameter"
- txtPort.SelStart = 0
- txtPort.SelLength = Len(txtPort.Text)
- txtPort.SetFocus
- Exit Sub
- End If
- 'Check for valid HostName and Address
- PortNum = temp
- If txtHostName.Text <> "" Then
- HostName = txtHostName.Text
- HostAddress = txtHostAddress.Text
- End If
- 'Display the client form
- frmClient.Show
- Unload Me
- Exit Sub
- Connect_Failure:
- Resume Exit_Sub
- Exit_Sub:
- End Sub
- Private Sub Command1_Click()
- 'Unload the form
- Unload Me
- End Sub
- Private Sub Form_Activate()
- 'Set focus to the Active form
- txtName.SetFocus
- End Sub
- Private Sub Form_Load()
- 'center form on screen and set
- Me.Top = Screen.Height / 2 - Me.Height / 2
- Me.Left = Screen.Width / 2 - Me.Width / 2
- 'Set Port Number, Host Name and Address
- If PortNum <> 0 Then txtPort.Text = PortNum
- txtHostAddress.Text = HostAddress
- txtHostName.Text = HostName
- txtName.Text = ScreenName
- End Sub
- Private Sub txtHostAddress_Change()
- 'Validate entries on the form
- If txtHostName.Text = "" And txtHostAddress.Text <> "" Then
- txtHostName.TabStop = False
- txtHostName.BackColor = vbGrayText
- txtHostName.TabStop = True
- txtHostName.BackColor = &H80000005
- End If
- ' If all entries are made, enable connection
- If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
- cmdConnect.Enabled = True
- cmdConnect.Default = True
- cmdConnect.Enabled = False
- cmdConnect.Default = False
- End If
- End Sub
- Private Sub txtHostName_Change()
- ' Host name is being modified/changed set properties
- If txtHostName.Text <> "" Then
- txtHostAddress.BackColor = vb3DShadow
- txtHostAddress.TabStop = False
- txtHostName.BackColor = &H80000005
- txtHostAddress.TabStop = True
- txtHostAddress.BackColor = &H80000005
- If txtHostAddress <> "" Then txtHostName.BackColor = vb3DShadow
- End If
- ' If all entries are made, enable connection
- If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
- cmdConnect.Enabled = True
- cmdConnect.Default = True
- cmdConnect.Enabled = False
- cmdConnect.Default = False
- End If
- End Sub
- Private Sub txtName_Change()
- ' Name is being modified/changed
- If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
- cmdConnect.Enabled = True
- cmdConnect.Default = True
- cmdConnect.Enabled = False
- cmdConnect.Default = False
- End If
- End Sub
- Private Sub txtPort_Change()
- 'Port is being modified/changed
- If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
- cmdConnect.Enabled = True
- cmdConnect.Default = True
- cmdConnect.Enabled = False
- cmdConnect.Default = False
- End If
- End Sub
-